package com.cc.guavaeventbusdemo.component;

import com.cc.guavaeventbusdemo.domain.PatientAdmissionEvent;
import com.google.common.eventbus.Subscribe;

public class DatabaseUpdater {
    @Subscribe
    public void updateDatabase(PatientAdmissionEvent event) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("[数据库] 更新患者 " + event.getPatientId() + " 住院记录， 线程" + Thread.currentThread().getName());
    }
}
